import {postJson, get} from "./request";

export const menuHttp = {

  get: function (menuId) {
    let  params =  {
      url: '/menu',
      data: {
        'menuId': menuId,
      }
    }
    return get(params)
  },


  tree: function () {
    let  params =  {
      url: '/menu/tree'

    }
    return get(params)
  },

  listPage: function (pageNum,pageSize) {
    let  params =  {
      url: '/menu/list',
      data: {
        'pageNum': pageNum,
        'pageSize': pageSize
      }
    }
    return get(params)
  },

  /*
  用户添加
 */
  add: function (form) {
    let  params =  {
      url: '/menu/add',
      data: {
        'menuName': form.menuName,
        'perms': form.perms,
        'pid': form.pid,
        'pidList': form.pidList,
        'type': form.type,
        'isShow': form.isShow
      }
    }
    return postJson(params)
  },


  /*
    用户删除
   */
  del: function (menuId) {
    let  params =  {
      url: '/menu/del',
      data: {
        'menuId': menuId
      }
    }
    return postJson(params)
  },


  /*
    用户修改
   */
  edit: function (form) {
    let  params =  {
      url: '/menu/edit',
      data: {
        'menuId': form.menuId,
        'menuName': form.menuName,
        'perms': form.perms,
        'pid': form.pid,
        'pidList': form.pidList,
        'type': form.type,
        'isShow': form.isShow
      }
    }
    return postJson(params)
  },



}



